# -*- coding: utf-8 -*-
"""
# @Time    : 2021/1/7 下午2:52
# @Author  : tgy
"""




def my_for(iterable, key):
    ...

    # iter = iterable.__iter__()
    iter = iterable.__iter__()

    while True:
        try:
            result = next(iter)
            key(result)
        except StopIteration:
            break

import iterable


if __name__ == '__main__':
    ...
    # name = list('')
    # print(name.__iter__())
    # age = 20
    # print(age.__iter__())

    # 1. 通过__iter__()获取迭代对象
    # 2. 每次调用 __next__(),获取值，直到抛 Stop
    # my_for("abc", lambda x: print(x))
    iterable.score = 20
    iterable.printScore()